#include<cstdio>
using namespace std;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n,p[200001],t=0,l,r;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&p[i]);
		t++;
	}
	l=-1;
	while(t>0){
		for(int i=1;i<=n;i++){
			if(p[i]==-1)continue;
			r=p[i];
			if(r!=l){
				printf("%d ",i);
				p[i]=-1;
				t--;
			}
			l=r;
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
